package com.cnooc.aicv.aicv_lm_app;



import java.sql.*;

public class KingbaseDBTest {
    public static String url = "jdbc:kingbase8://127.0.0.1:5432/test";
    public static String name = "com.kingbase8.Driver";
    public static String user = "system";
    public static String passsword = "Zhinengshipin@2024";

    public static void main(String[] args) {

        try {
            String sql = "select * from table_name";
            Connection conn = DriverManager.getConnection(url,user,passsword);
            PreparedStatement pst = conn.prepareStatement(sql);//准备执行sl

            ResultSet ret = pst.executeQuery();

            while (ret.next()){
                String id = ret.getString(1);
                String name = ret.getString(2);
                String age = ret.getString(3);
                System.out.println(id+"\t"+name+"\t"+age);
            }

            ret.close();
            conn.close();
            pst.close();

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}